﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Edu.Web.Data.DAO;
using Edu.Web.Data.Entity;
using ESoft.Core.Data.DAO;
using ESoft.Core.Data.Service.Impl;
using ESoft.Core.Utils.Extensions;

namespace Edu.Web.Data.Service.Impl
{
    public class CourceService : BaseService<CourceEntity, long>, ICourceService
    {
        public CourceService(ICourceDAO dao) : base(dao)
        {
        }

        public void saveOrUpdateCource(CourceEntity courceVO)
        {
            if (courceVO.Id > 0)
            {
                CourceEntity courcePO = this._baseDao.Find(courceVO.Id);
                if (courcePO.IsNotNull())
                {
                    courcePO.CourceName = courceVO.CourceName;
                    courcePO.CourceNo = courceVO.CourceNo;
                    this._baseDao.Update(courcePO);
                }
            }
            else
            {
                this._baseDao.Add(courceVO);
            }
        }
    }
}